{extend name="PublicBase/showBase" /}

{block name="body"}
<div class="main">
    <div class="row">
        <div class="col-md-12">
            <section class="tile color transparent-black">
                <div class="tile-header bg-transparent-black-2">
                    <h1>
                        {if condition="$Info eq ''"}
                            {:lang('WxTwXz')}
                        {else /}
                            {:lang('WxTwGx')}
                        {/if}
                    </h1>
                    <div class="controls">
                        <a href="javascript:void(0);" onclick="window.history.back();"><i class="fa fa-arrow-left"></i></a>
                        {if condition="$Info eq ''"}
                            <a href="{:url('WechatReply/showAdd')}"><i class="fa fa-refresh"></i></a>
                        {else /}
                            <a href="{:url('WechatReply/showEdit', array('id'=>$Info['key_id']))}"><i class="fa fa-refresh"></i></a>
                        {/if}
                    </div>
                </div>
                <div class="tile-body nopadding">
                    <form class="FormTable" action="" method="post">
                        <div class="tile-body">
                            <div class="row">
                                <div class="form-group col-sm-12">
                                    <label>{:lang('WxTwGjz')}</label>
                                    <input type="text" class="form-control" name="key_name" value="{$Info.key_name}" placeholder="{:lang('WxTwGjzWk')}" />
                                </div>
                                <div class="form-group col-sm-12">
                                    <label>{:lang('WxTwLx')}</label>
                                    <select class="chosen-select chosen-transparent form-control" name="key_type" id="key_type">
                                        <option value="1" {eq name="Info['key_type']" value="1"}selected{/eq}>{:lang('WxTwLx1')}</option>
                                        <option value="2" {eq name="Info['key_type']" value="2"}selected{/eq}>{:lang('WxTwLx2')}</option>
                                    </select>
                                </div>
                                <div class="form-group col-sm-12 key_text">
                                    <label>{:lang('WxTwNr')}</label>
                                    <input type="text" class="form-control" name="key_text" value="{$Info.key_text}" placeholder="{:lang('WxTwNrWk')}" />
                                </div>
                                <div class="form-group col-sm-12 key_news" style="display: none">
                                    <label>{:lang('WxTwBt')}</label>
                                    <input type="text" class="form-control" name="key_title" value="{$Info.key_title}" placeholder="{:lang('WxTwBtWk')}" />
                                </div>
                                <div class="form-group col-sm-12 key_news" style="display: none">
                                    <label>{:lang('WxTwJj')}</label>
                                    <input type="text" class="form-control" name="key_info" value="{$Info.key_info}" placeholder="{:lang('WxTwJjWk')}" />
                                </div>
                                <div class="form-group col-sm-12 key_news" style="display: none">
                                    <label>{:lang('WxTwTp')}</label>
                                    <input type="text" class="form-control" name="key_img" value="{$Info.key_img}" placeholder="{:lang('WxTwTpWk')}" />
                                </div>
                                <div class="form-group col-sm-12 key_news" style="display: none">
                                    <label>{:lang('WxTwWz')}</label>
                                    <input type="text" class="form-control" name="key_url" value="{$Info.key_url}" placeholder="{:lang('WxTwWzWk')}" />
                                </div>
                                <div class="form-group col-sm-12">
                                    <label>{:lang('WxTwZt')}</label>
                                    <select class="chosen-select chosen-transparent form-control" name="key_state">
                                        <option value="1" {eq name="Info['key_state']" value="1"}selected{/eq}>{:lang('WxTwZt1')}</option>
                                        <option value="2" {eq name="Info['key_state']" value="2"}selected{/eq}>{:lang('WxTwZt2')}</option>
                                    </select>
                                </div>
                            </div>
                        </div>
                    </form>
                </div>
                <div class="tile-footer bg-transparent-black-2 rounded-bottom-corners">
                    <div class="row">
                        <div class="col-sm-12 text-center">
                            <button type="button" class="btn btn-{:config('CNF_BTNCOLOR')} ajax-post">{:lang('XtAnTj')}</button>
                        </div>
                    </div>
                </div>
            </section>
        </div>
    </div>
</div>
{/block}

{block name="script"}
    <script>
        $(function(){
            {if condition="$Info['key_type'] eq 1"}
                $('.key_text').show();
                $('.key_news').hide();
            {elseif condition="$Info['key_type'] eq 2" /}
                $('.key_news').show();
                $('.key_text').hide();
            {/if}

            $('#key_type').change(function(){
                //$('.key_text,.key_news').hide('');
                var key_type = $('#key_type').val();
                if(key_type == 1){
                    $('.key_text').show();
                    $('.key_news').hide();
                }else if(key_type == 2){
                    $('.key_news').show();
                    $('.key_text').hide();
                }
            });
        })
    </script>
{/block}
      
